<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<form name="myForm">
	<fieldset class="layui-elem-field layui-field-title">
	  	<legend>angular表单验证</legend>
	</fieldset>
	<div class="layui-form-item">
		<label class="layui-form-label">用户名</label>
		<div class="layui-input-block">
			<input class="layui-input" type="text" name="user" ng-model="user" required>
			<span style="color:red" ng-show="myForm.user.$dirty && myForm.user.$invalid">
				<span ng-show="myForm.user.$error.required">用户名是必须的。</span>
			</span>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">邮箱</label>
		<div class="layui-input-block">
			<input class="layui-input" type="email" name="email" ng-model="email" required>
			<span style="color:red" ng-show="myForm.email.$dirty && myForm.email.$invalid">
				<span ng-show="myForm.email.$error.required">邮箱是必须的。</span>
				<span ng-show="myForm.email.$error.email">非法的邮箱地址。</span>
			</span>
		</div>
	</div>
	<div class="layui-form-item">
	    <div class="layui-input-block">
	    	<button class="layui-btn layui-btn-normal" type="submit" ng-disabled="myForm.user.$dirty && myForm.user.$invalid || myForm.email.$dirty && myForm.email.$invalid">立即提交</button>
	    </div>
	</div>
</form>



